<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use think\Session;
/*首页*/
class Index extends Controller {


    public function index(){

        $user=Session::get('user_id');

        if (!empty($user)){
            //判断是否有session
//            return $this->fetch();
            return $this->fetch('',[
                'os'=>PHP_OS,
                'yxhj'=>$_SERVER["SERVER_SOFTWARE"],
                'php_version'=>PHP_VERSION,
                'db_version'=>Db::query('select VERSION() as db_version')[0]['db_version'],
                'server_ip'=>GetHostByName($_SERVER['SERVER_NAME']),
                'language'=>$_SERVER['HTTP_ACCEPT_LANGUAGE'],
                'host'=>$_SERVER['SERVER_PORT'],
                'time'=>date("Y-m-d H:i:s"),
                'user'=>$user
            ]);
        }else{

            $this->redirect('admin/login/index');
        }


    }









}
